<?php
class EditAttach extends Action {
	/* (non-PHPdoc)
	 * @see Action::execute()
	 */
	public function execute($params) {
		check_login ( ADMIN_LOGIN_PAGE );
		$data = array ('success' => false );
		$aid = irqst ( 'aid' );
		$name = rqst ( 'name' );
		$alt = rqst ( 'alt' );
		if ($aid) {
			$att ['name'] = $name;
			$att ['alt_text'] = $alt;
			$atM = new WebAttachmentModel ();
			$rst = $atM->update ( $att, $aid );
			if ($rst !== false) {
				$data ['success'] = true;
			} else {
				$data ['msg'] = '出错了:' . $atM->last_error_msg ();
			}
		} else {
			$data ['msg'] = '未指定编号';
		}
		return new JsonView ( $data );
	}
}